/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.PayMethodPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.IPayMethodMapper;

@Service
public class PayMethodService {
	@Autowired
	private IPayMethodMapper payMethodMapper;
	
	/**
	 * 根据ID获取PayMethodPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return PayMethodPo
	 */
	public PayMethodPo getPayMethod(int id) {
		return payMethodMapper.findPayMethodById(id);
	}
	
	/**
	 * 根据条件获取PayMethodPo对象，并返回查询的数据总数
	 * 
	 * @param payMethod
	 * @Author 迷蝶
	 * @return ResultPageTo<PayMethodPo>
	 */
	public ResultPageTo<PayMethodPo> getPayMethods(PayMethodPo payMethod) {
		return new ResultPageTo<PayMethodPo>(payMethod.getStart(), payMethod.getSize(), 
				payMethodMapper.findPayMethodCount(payMethod), payMethodMapper.findPayMethods(payMethod));
	}
	
	/**
	 * 根据ID删除PayMethodPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delPayMethod(int id) {
		return payMethodMapper.delPayMethodById(id);
	}
	
	/**
	 * 增加PayMethodPo对象
	 * 
	 * @param payMethod
	 * @Author 迷蝶
	 */
	public Integer addPayMethod(PayMethodPo payMethod) {
		return payMethodMapper.addPayMethod(payMethod);
	}
	
	/**
	 * 根据条件更新PayMethodPo对象
	 * 
	 * @param payMethod
	 * @Author 迷蝶
	 */
	public Integer updatePayMethod(PayMethodPo payMethod) {
		return payMethodMapper.updatePayMethod(payMethod);
	}
	
}
